package redisinit

import (
	"fmt"
	"github.com/go-redis/redis"
	"profile/appconfig"
)

var Rdb *redis.Client

func RedisConfig() {
	appconf := appconfig.Addconf.Redis
	Rdb = redis.NewClient(&redis.Options{
		Addr:     appconf.Addr,
		Password: appconf.Password,
		DB:       appconf.Db,
	})
	err := Rdb.Ping().Err()
	if err != nil {
		fmt.Println("redis连接失败")
		return
	}
	fmt.Println("redis连接成功")
}
